<template>
	<div>		
	<mt-swipe :auto="4000">
		<!--在组件中，使用v-for循坏，一定要使用:key-->
		  <mt-swipe-item v-for="item in lunboList" :key="item.url">
		  	<img :src="item.img"/>
		  </mt-swipe-item>
	</mt-swipe>
	<h1>home</h1>
	</div>
</template>

<script>
	import { Toast } from 'mint-ui';
	export default{
		data(){
			return{
				lunboList:[] //保存轮播图的数组
			}
		},
		created(){
			this.getLunbo();
		},
		methods:{
			getLunbo(){//获取轮播图数据的方法
				this.$http.get('').then(result=>{
					var result = result.body;
//					console.log("数据"+result);
					if(result.status===0){
//						成功数据
						this.lunboList = result.message;
					}else{						
						Toast({
							message:'请求数据失败',
							duration:3000
						});
					}
				})
				
			}
		}
	}
	
</script>
<style lang="scss" scoped="">
 .mint-swipe{
 	height: 300px;
 	
 	.mint-swipe-item{
 		&:nth-child(1){
 			background: red;
 		}
 		&:nth-child(2){
 			background: green;
 		}
 		&:nth-child(3){
 			background: yellow;
 		}
 	}
 }
</style>